/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.agilelang.generator.webservices.php;


import org.agilelang.mvc.Facade;
import org.agilelang.object.Controller;

/**
 *
 * @author Roderick
 */
public class Main extends Facade {

    String tpl = "";
    public void setTemplate(String clasic) {
        tpl = clasic;
    }  
    
    public Main(String path_xml, String path_app){
        this.path_xml = path_xml;
        this.path_app = path_app;
        //scanner_parser(new JTextArea());
        readProject();
    }
            

    public void processFile() {
        GFile gfile = new GFile(path_app, this.project.application);
        gfile.setTemplate(tpl);
        gfile.process();
        //gfile.otherFile(project.application.name);
        //gfile.generateDatabase_php(project.application.host, project.application.login, project.application.password, project.application.database);
    }

    public void processApp() {
        processFile();
        processMenu();
        
        processModel();        
    }

    public void processMenu() {
        GMenu generate_menu = new GMenu(project.application.name, path_app, project.menus);
        generate_menu.setTemplate(tpl);
        generate_menu.process();
    }

    public void processModel() {
        GModelOld generate_model = new GModelOld(path_app , project.models);
        generate_model.setTemplate(tpl);
        generate_model.process();
    } 
    
    public void processGWebClient() {
        GWebClientOld generate_model = new GWebClientOld(path_app , project);
        generate_model.setTemplate(tpl);
        generate_model.process();
    }
    
    public void processGWebServices() {
        GWebServicesOld generate_model = new GWebServicesOld(path_app , project);
        generate_model.setTemplate(tpl);
        generate_model.process();
    }
}
